home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Online / AmiSSL / Install_AmiSSL < prev    next >
Text File  |  2001-07-20  |  8KB  |  317 lines

  1. ; $VER: Install_AmiSSL 1.0 (21.7.2001)
  2. ;
  3. ; © 2001 Andrija Antonijevic <TheAntony@bigfoot.com>
  4. ;
  5.  
  6. (set #cpu (database "cpu"))
  7.  
  8. (set #where-amissldir
  9.     (cat "Into which directory would you like to install AmiSSL "
  10.          "certificates and amissl command line utility? Directory "
  11.          "AmiSSL WILL be created there."
  12.     )
  13. )
  14.  
  15. (set #where-libs
  16.     (cat "Into which directory should the library files be installed? "
  17.          "This directory MUST be part of your LIBS: assign. Directory "
  18.          "amissl will be created there."
  19.     )
  20. )
  21.  
  22. (set #user-startup-msg
  23.     (cat "Installer needs to add AmiSSL: assign to user-startup "
  24.          "or AmiSSL won't be able to find its certificates."
  25.     )
  26. )
  27.  
  28. (set #where-ciphers-dir
  29.     (cat "Please select the directory into which the archives "
  30.          "containing ciphers (blowfish.lha, des.lha, etc) "
  31.          "have been downloaded."
  32.     )
  33. )
  34.  
  35. (set #ciphers-dir
  36.     (askdir (prompt #where-ciphers-dir)
  37.         (help @askdir-help)
  38.         (default "RAM:")
  39.     )
  40. )
  41.  
  42. (if (exists "Work:")
  43.     (set #where-amissldir-default "Work:")
  44. ;else
  45.     (set #where-amissldir-default "SYS:")
  46. )
  47.  
  48. (set #AmiSSLDir
  49.     (tackon
  50.         (askdir (prompt #where-amissldir)
  51.             (help @askdir-help)
  52.             (default #where-amissldir-default)
  53.         )
  54.         "AmiSSL"
  55.     )
  56. )
  57.  
  58. (set #ask-path
  59.     (cat "Would you like Installer to add " #AmiSSLDir " directory "
  60.          "to the system path?"
  61.     )
  62. )
  63.  
  64. (set #ask-path-help
  65.     (cat "If you select \"Yes\", you will be able to run \"amissl\" "
  66.          "command without specifying its full path."
  67.     )
  68. )
  69.  
  70. (if (askbool (prompt #ask-path) (help #ask-path-help) (default 1))
  71.     (set #startup-command (cat "Assign AmiSSL: \"" #AmiSSLDir "\"\nPath AmiSSL: ADD\n"))
  72. ;else
  73.     (set #startup-command (cat "Assign AmiSSL: \"" #AmiSSLDir "\"\n"))
  74. )
  75.  
  76. (set #LibsDir
  77.     (askdir (prompt #where-libs)
  78.         (help @askdir-help)
  79.         (default "LIBS:")
  80.     )
  81. )
  82.  
  83. (set #CiphersLibsDir (tackon #LibsDir "amissl"))
  84.  
  85. (set #ask-main-lib-type "Which version of amissl.library would you like to install?")
  86.  
  87. (set #main-lib-type
  88.     (askchoice
  89.         (prompt #ask-main-lib-type)
  90.         (help @askchoice-help)
  91.         (choices "International version" "USA/Canada version")
  92.         (default 0)
  93.     )
  94. )
  95.  
  96. (set #ask-CPU
  97.     (cat "AmiSSL comes in several versions for different processors. "
  98.          "Which version of AmiSSL would you like to install?"
  99.     )
  100. )
  101.  
  102. (if (= #cpu "68060")
  103.     (set #default-cpu 3)
  104. ;else
  105.     (if (= #cpu "68040")
  106.         (set #default-cpu 2)
  107.     ;else
  108.         (if (or (= #cpu "68020") (= #cpu "68030"))
  109.             (set #default-cpu 1)
  110.         ;else
  111.             (set #default-cpu 0)
  112.         )
  113.     )
  114. )
  115.  
  116. (set #cpu-id
  117.     (askchoice
  118.         (prompt #ask-CPU)
  119.         (help @askchoice-help)
  120.         (choices "68000" "68020" "68040" "68060")
  121.         (default #default-cpu)
  122.     )
  123. )
  124.  
  125. (procedure P_Cleanup
  126.     (makeassign "AmiSSLInstall")
  127.     (delete "T:AmiSSLTemp" (all))
  128. )
  129.  
  130. (procedure P_InstallMainLibrary #lib-type #cpu-index #destination
  131.     ; USA/Canada 68000 version is in the archive
  132.     (if (and (= #lib-type 1) (= #cpu-index 0))
  133.         (copylib
  134.             (source "AmiSSLInstall:lib/amissl_usa_000.library")
  135.             (dest #destination)
  136.             (newname "amissl.library")
  137.         )
  138.     ;else
  139.         (
  140.             (set #patch-name
  141.                 (cat
  142.                     (select #lib-type "amissl_int_" "amissl_usa_")
  143.                     (select #cpu-index "000" "020" "020" "020")
  144.                     ".pch"
  145.                 )
  146.             )
  147.  
  148.             (working "Patching amissl.library. Please wait...")
  149.  
  150.             (set #result-code
  151.                 (run
  152.                     (cat "AmiSSLInstall:bin/spatch "
  153.                          "-oT:AmiSSLTemp/amissl.library "
  154.                          "-pAmiSSLInstall:lib/" #patch-name " "
  155.                          "AmiSSLInstall:lib/amissl_usa_000.library"
  156.                     )
  157.                     (safe)
  158.                 )
  159.             )
  160.  
  161.             (if (<> #result-code 0) (abort "Error while patching amissl.library"))
  162.  
  163.             (copylib
  164.                 (source "T:AmiSSLTemp/amissl.library")
  165.                 (dest #destination)
  166.             )
  167.         )
  168.     )
  169. )
  170.  
  171. (procedure P_GetCipherFileName #name #cpu-index
  172.     (if (= #name "blowfish")
  173.         (set #ext (select #cpu-index ".000" ".020-030-060" ".040" ".020-030-060"))
  174.     (if (= #name "cast")
  175.         (set #ext (select #cpu-index ".000" ".020-030-060" ".040" ".020-030-060"))
  176.     (if (= #name "des")
  177.         (set #ext (select #cpu-index ".000" ".020-030-060" ".040" ".020-030-060"))
  178.     (if (= #name "idea")
  179.         (set #ext (select #cpu-index ".000" ".020-030-060" ".040" ".020-030-060"))
  180.     (if (= #name "md2")
  181.         (set #ext (select #cpu-index ".000" ".020-030-040-060" ".020-030-040-060" ".020-030-040-060"))
  182.     (if (= #name "md5")
  183.         (set #ext (select #cpu-index ".000" ".020-030-040-060" ".020-030-040-060" ".020-030-040-060"))
  184.     (if (= #name "mdc2")
  185.         (set #ext "")
  186.     (if (= #name "rc2")
  187.         (set #ext (select #cpu-index ".000" ".020-030-060" ".040" ".020-030-060"))
  188.     (if (= #name "rc4")
  189.         (set #ext (select #cpu-index ".000" ".020-030-060" ".040" ".020-030-060"))
  190.     (if (= #name "rc5")
  191.         (set #ext (select #cpu-index ".000" ".020-030" ".040" ".060"))
  192.     (if (= #name "ripemd")
  193.         (set #ext (select #cpu-index ".000" ".020-030-040-060" ".020-030-040-060" ".020-030-040-060"))
  194.     (if (= #name "sha")
  195.         (set #ext (select #cpu-index ".000" ".020-030-040-060" ".020-030-040-060" ".020-030-040-060"))
  196.     ;else
  197.         (abort "Unknown cipher/message digest " #name ". Please write "
  198.                "to the author quoting this message."
  199.         )
  200.     ))))))))))))
  201.  
  202.     (set #result (cat #name ".library" #ext))
  203. )
  204.  
  205. (set #mdc2-des-error
  206.     (cat "You have downloaded MDC2 message digest but choose not to "
  207.          "download DES cipher. Since MDC2 requires DES to operate, "
  208.          "AmiSSL will be installed as if you haven't downloaded "
  209.          "MDC2 digest."
  210.     )
  211. )
  212.  
  213. (procedure P_ExtractCipher #name #cpu-index
  214.     (set #cipher-filename (P_GetCipherFileName #name #cpu-index))
  215.  
  216.     (set #result-code
  217.         (run
  218.             (cat "AmiSSLInstall:bin/lhex -qaFw=T:AmiSSLTemp/ x "
  219.                  "\"" (tackon #ciphers-dir #name) ".lha\" "
  220.                  #cipher-filename
  221.             )
  222.             (safe)
  223.         )
  224.     )
  225.  
  226.     (if (<> #result-code 0) (abort "Error while extracting files from archive " #name ".lha"))
  227.  
  228.     (rename (cat "T:AmiSSLTemp/" #cipher-filename) (cat "T:AmiSSLTemp/" #name ".library") (safe))
  229. )
  230.  
  231. (procedure P_InstallCipher #name #cpu-index #destination
  232.     (set #cipher-exists (exists (cat (tackon #ciphers-dir #name) ".lha")))
  233.  
  234.     (if (and (and #cipher-exists (= #name "mdc2")) (not (exists (tackon #ciphers-dir "des.lha"))))
  235.         (
  236.             (message #mdc2-des-error)
  237.             (set #cipher-exists 0)
  238.         )
  239.     )
  240.  
  241.     (if #cipher-exists
  242.         (
  243.             (P_ExtractCipher #name #cpu-index)
  244.             (copylib
  245.                 (source (cat "T:AmiSSLTemp/" #name ".library"))
  246.                 (dest #destination)
  247.             )
  248.         )
  249.     ;else
  250.         (copylib
  251.             (source (cat "AmiSSLInstall:dummy_ciphers/" #name ".library"))
  252.             (dest #destination)
  253.         )
  254.     )
  255. )
  256.  
  257. (onerror (P_Cleanup))
  258.  
  259. (complete 0)
  260.  
  261. (makeassign "AmiSSLInstall" (expandpath "") (safe))
  262.  
  263. (makedir #CiphersLibsDir)
  264. (makedir "T:AmiSSLTemp")
  265.  
  266. (P_InstallMainLibrary #main-lib-type #cpu-id #LibsDir)
  267.  
  268. (complete 25)
  269.  
  270. (P_InstallCipher "blowfish" #cpu-id #CiphersLibsDir)
  271. (complete 30)
  272. (P_InstallCipher "cast" #cpu-id #CiphersLibsDir)
  273. (complete 35)
  274. (P_InstallCipher "des" #cpu-id #CiphersLibsDir)
  275. (complete 40)
  276. (P_InstallCipher "idea" #cpu-id #CiphersLibsDir)
  277. (complete 45)
  278. (P_InstallCipher "md2" #cpu-id #CiphersLibsDir)
  279. (complete 50)
  280. (P_InstallCipher "md5" #cpu-id #CiphersLibsDir)
  281. (complete 55)
  282. (P_InstallCipher "mdc2" #cpu-id #CiphersLibsDir)
  283. (complete 60)
  284. (P_InstallCipher "rc2" #cpu-id #CiphersLibsDir)
  285. (complete 65)
  286. (P_InstallCipher "rc4" #cpu-id #CiphersLibsDir)
  287. (complete 70)
  288. (P_InstallCipher "rc5" #cpu-id #CiphersLibsDir)
  289. (complete 75)
  290. (P_InstallCipher "ripemd" #cpu-id #CiphersLibsDir)
  291. (complete 80)
  292. (P_InstallCipher "sha" #cpu-id #CiphersLibsDir)
  293. (complete 85)
  294.  
  295. (makedir #AmiSSLDir (infos))
  296. (copyfiles
  297.     (source "AmiSSLInstall:AmiSSLDir")
  298.     (dest #AmiSSLDir)
  299.     (infos)
  300.     (all)
  301. )
  302.  
  303. (complete 95)
  304.  
  305. (startup @app-name
  306.     (prompt #user-startup-msg)
  307.     (help @startup-help)
  308.     (command #startup-command)
  309. )
  310.  
  311. (P_Cleanup)
  312.  
  313. (complete 100)
  314.  
  315. (set @default-dest #LibsDir)
  316. (exit "AmiSSL installation finished succesfully. Enjoy!")
  317.